package com.google.code.ptrends.services.implementations;

import java.sql.SQLException;

import com.google.code.ptrends.common.entities.Session;
import com.google.code.ptrends.services.DataService;
import com.google.code.ptrends.services.SessionService;

public class DatabaseSessionService implements SessionService {

    private DataService dataService;

    public DatabaseSessionService(DataService dataService) {
	if (dataService == null)
	    throw new IllegalArgumentException("Illegal null-reference dataService");

	this.dataService = dataService;
    }

    @Override
    public Session createSession(int supplierID) {
	Session session = new Session();
	session.setSupplierID(supplierID);

	return session;
    }

    @Override
    public void saveSession(Session session) throws SQLException {
	dataService.saveSession(session);
    }
}
